package com.cbhb.sys;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;

public class CountConsistentStrings {

    public static int countConsistentStrings(String allowed, String[] words) {
        int sum = words.length;
        List<Character> collect = allowed.chars().mapToObj(i -> (char) i).collect(Collectors.toList());
        for(String str: words) {
            for(char cha: str.toCharArray()) {
                if (!collect.contains(cha))  {
                    sum--;
                    break;
                }
            }
        }
        List<String> linkList = new LinkedList<>();
        return sum;

    }

    public static void main(String[] args) {
        System.out.println(countConsistentStrings("cad", new String[]{"cc", "acd", "b", "ba", "bac", "bad", "ac", "d"}));
    }
}
